import java.util.Scanner;

public class FindMaxString {
    String string;

    public FindMaxString(String string) {
        this.string = string;
    }

    public int Find(String string) {
        if(string == null || string.length() == 0){
            return 0;
        }
        int len = 128;
        int slow = 0;
        int fast = 1;
        int max = -1;
        char[] arr = string.toCharArray();
        while (slow < arr.length) {
            boolean flag = false;
            int[] dic = new int[128];
            int cnt = 0;
            while (fast <arr.length) {
                dic[arr[fast] - 97]++;
                for (int i = 0; i < dic.length; i++) {
                    if(dic[i] > 1){

                    }
                }
            }
            if (cnt > max) {
                max = cnt;
            }
            slow++;
            fast = slow + 1;
        }
        return max;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        FindMaxString findMaxString = new FindMaxString(str);
        System.out.println(findMaxString.Find(str));
    }
}
